package cn.xyinping.basic.interceptor.config;

import cn.xyinping.basic.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 27266
 * @desrciption
 * @date 2021/10/31
 */
@Configuration //  相当于配置信息， 配置类
public class LoginConfigurer implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/login/**")
                .excludePathPatterns("/user/phone/registr")
                .excludePathPatterns("/verifycode/smsCode")
                .excludePathPatterns("/pay/notify")
                .excludePathPatterns("/fastDfs/**");
    }
}
